const Router = require("koa-router")
const fs = require("fs")
const Path = require("path")

/**
 * 路由对象
 * @type {Router}
 */
const router = new Router({
  prefix: '/docs'
})

/// 路由配置 ======================================
/**
 * 获取API界面
 */
router.get('/api', async function (ctx){
  ctx.response.type = 'html';
  const allSrc = Path.resolve(__dirname, "../../static/docs/api/index.html")
  ctx.response.body =  fs.createReadStream(allSrc)
})

module.exports = router
